"use strict";
cc._RF.push(module, 'b4b71QPx4JEnL4g3u73c9+c', 'choose_player_skill_info');
// scripts/choose_player_skill_info.js

"use strict";

var e = require;
var t = module;
var o = exports;

var _ii,
    nn = void 0 && (void 0).__extends || (_ii = function ii(t, e) {
  return (_ii = Object.setPrototypeOf || {
    __proto__: []
  } instanceof Array && function (t, e) {
    t.__proto__ = e;
  } || function (t, e) {
    for (var o in e) {
      Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
    }
  })(t, e);
}, function (t, e) {
  function o() {
    this.constructor = t;
  }

  _ii(t, e), t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o());
}),
    rr = void 0 && (void 0).__awaiter || function (t, e, o, i) {
  return new (o || (o = Promise))(function (n, a) {
    function r(t) {
      try {
        l(i.next(t));
      } catch (e) {
        a(e);
      }
    }

    function s(t) {
      try {
        l(i["throw"](t));
      } catch (e) {
        a(e);
      }
    }

    function l(t) {
      var e;
      t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
        t(e);
      })).then(r, s);
    }

    l((i = i.apply(t, e || [])).next());
  });
};

var oo = void 0 && (void 0).__decorate || function (e, t, a, n) {
  var i,
      o = arguments.length,
      s = o < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, a) : n;
  if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);else for (var r = e.length - 1; r >= 0; r--) {
    (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
  }
  return o > 3 && s && Object.defineProperty(t, a, s), s;
};

Object.defineProperty(o, "__esModule", {
  value: !0
});

var a = e("BaseModuleUI"),
    n = e("GlobalParams"),
    i = e("AudioManager"),
    r = e("CommonHelper"),
    s = e("Game"),
    l = e("RoleSoldierInfo"),
    _ = e("AD"),
    c = cc._decorator,
    d = c.ccclass,
    h = c.property,
    u = function (e) {
  function t() {
    var t = null !== e && e.apply(this, arguments) || this;
    return t.skill_name = null, t.skill_info = null, t.skill_cooling_time = null, t.skill_node = null, t.choose_skill = [1, 2], t;
  }

  return nn(t, e), t.prototype.initView = function () {
    this.showChooseSkillInfo(), this.showSkillInfo(2);
  }, t.prototype.OnClick = function (t) {
    var o = this;
    e.prototype.OnClick.call(this, t);
    var a = t.node.name;

    switch (a) {
      case "skill_1":
      case "skill_2":
      case "skill_3":
      case "skill_4":
      case "skill_5":
      case "skill_6":
        var s = Number(r["default"].getNameType(a, "skill_")),
            l = function l() {
          if (o.choose_skill[1] != s) {
            var e = [o.choose_skill[1], s];
            o.choose_skill = e, n.GlobalParams.MatchGamePlayer[n.GlobalParams.MatchMyIndex].player_skill = o.choose_skill;
          }

          o.showSkillInfo(s);
        },
            c = n.GlobalParams.PlayerInfo.value;

        -1 != c.unlock_skill.indexOf(s) || _["default"].getInstance().getGameTestVersion() ? l() : _["default"].getInstance().showVideo(function (e) {
          i["default"].playGameBGM(), e == _.ResultEnum.Success && (c.unlock_skill.push(s), n.GlobalParams.PlayerInfo.value = c, l());
        });
    }
  }, t.prototype.showSkillInfo = function (e) {
    var t = l["default"].Player_Skill_Info[e - 1];
    this.skill_name.string = t.name, this.skill_info.string = t.skill_info, this.skill_cooling_time.string = t.cooling * (n.GlobalParams.ChangeGameMode == s.GameType.endless_mode ? 0.5 : 1) + "秒", this.showChooseSkillInfo();
  }, t.prototype.showChooseSkillInfo = function () {
    for (var e = n.GlobalParams.PlayerInfo.value, t = 0; t < this.skill_node.childrenCount; t++) {
      this.skill_node.children[t].children[0].active = -1 != this.choose_skill.indexOf(t + 1), this.skill_node.children[t].children[1].active = -1 == e.unlock_skill.indexOf(t + 1) && !_["default"].getInstance().getGameTestVersion();
    }
  }, oo([h(cc.Label)], t.prototype, "skill_name", void 0), oo([h(cc.Label)], t.prototype, "skill_info", void 0), oo([h(cc.Label)], t.prototype, "skill_cooling_time", void 0), oo([h(cc.Node)], t.prototype, "skill_node", void 0), oo([d], t);
}(a["default"]);

o["default"] = u;

cc._RF.pop();